package obj;


/*
 * 单例模式（饿汉式单例）
 * */
class Singleton {
    private static final Singleton single = new Singleton();
    private Singleton(){}

    public static Singleton getSingle() {
        return single;
    }
}

public class Test {
    public static void main(String[] args){
        Singleton obj1= Singleton.getSingle();
        System.out.println(obj1);
        Singleton obj2 = Singleton.getSingle();
        System.out.println(obj2);
        Singleton obj3 = Singleton.getSingle();
        System.out.println(obj3);

    }
}

